package xj.util.gui;

import java.awt.geom.Dimension2D;
import java.io.Serializable;

public class Dimension2DFloat 
  extends Dimension2D 
  implements Serializable {

  public float width;
  public float height;

  public Dimension2DFloat() {
  }

  public Dimension2DFloat(float width, float height) {
    this.width = width;
    this.height = height;
  }

  @Override
  public double getWidth() {
    return width;
  }

  @Override
  public double getHeight() {
    return height;
  }

  @Override
  public void setSize(double width, double height) {
    this.width = (float) width;
    this.height = (float) height;
  }

  public void setSize(Dimension2D dim) {
    if (dim != null) { 
      this.width = (float) dim.getWidth();
      this.height = (float) dim.getHeight();
    }
  }

  @Override
  public String toString() {
    return "[" + width + "," + height + "]";
  }

}
